CREATE TRIGGER UPDATE_ACCOUNT_ID_TRI BEFORE
INSERT ON ACCOUNTS FOR EACH ROW WHEN(NEW.ACCOUNT_ID IS NULL)
BEGIN
SELECT ACCOUNT_ID_SEQ.NEXTVAL INTO:NEW.ACCOUNT_ID FROM DUAL;
END;

CREATE TRIGGER UPDATE_GROUP_ID_TRI BEFORE
INSERT ON GROUPS FOR EACH ROW WHEN(NEW.GROUP_ID IS NULL)
BEGIN
SELECT GROUP_ID_SEQ.NEXTVAL INTO:NEW.GROUP_ID FROM DUAL;
END;

CREATE TRIGGER UPDATE_CONTACT_ID_TRI BEFORE
INSERT ON CONTACTS FOR EACH ROW WHEN(NEW.CONTACT_ID IS NULL)
BEGIN
SELECT CONTACT_ID_SEQ.NEXTVAL INTO:NEW.CONTACT_ID FROM DUAL;
END;
